import Mock from 'mockjs'
import user from './modules/user'
import permission from './modules/permission'
import meigui from '@/assets/images/玫瑰1.jpg'
import mantianxing from '@/assets/images/满天星1.jpg'
import jigeng from '@/assets/images/桔梗2.jpg'
import xiangrikui2 from '@/assets/images/向日葵2.jpg'
import xiangrikui3 from '@/assets/images/向日葵3.jpg'
import baihe from '@/assets/images/百合3.jpg'
const { mock } = Mock // Mock函数

// 拦截命中的请求
mock(RegExp("/user/login" + ".*"), 'get', user.loginAPI)
mock("/user/getpermissionRoutes", 'post',permission.getPermissionRoutesAPI)
// 事件
Mock.mock("/GetEvent", "post", (options) => {
  const { para} = JSON.parse(options.body);
  // 在实际情况下，这里可以进行用户名和密码的验证逻辑
  if (para === "1" ) {
    return {
      code: 200,
      data :'系统事件,系统,RTU,IEC104GPRS,状态,上线,2024-05-30 18:08:35,50,;系统事件,系统,RTU,IEC104GPRS,状态,下线,2024-05-30 12:14:03,665,;系统事件,系统,RTU,IEC104GPRS,状态,下线,2024-06-07 16:09:29,791,;系统事件,系统,RTU,IEC104GPRS,状态,上线,2024-06-07 16:09:01,266,;系统事件,系统,RTU,IEC104GPRS,状态,下线,2024-06-07 16:05:29,711,;系统事件,系统,RTU,IEC104GPRS,状态,上线,2024-06-10 21:41:17,780,;系统事件,系统,RTU,IEC104GPRS3,状态,上线,2024-06-09 16:11:04,330,;系统事件,系统,RTU,IEC104GPRS,状态,下线,2024-06-10 21:42:27,19,;系统事件,系统,RTU,IEC104GPRS,状态,上线,2024-06-10 21:42:14,373,;系统事件,系统,RTU,IEC104GPRS,状态,下线,2024-06-10 21:41:46,959,;系统事件,系统,RTU,IEC104GPRS,状态,上线,2024-05-10 21:42:31,968,;系统事件,系统,RTU,IEC104GPRS,状态,下线,2024-05-10 21:45:34,318,;系统事件,系统,RTU,IEC104GPRS,状态,上线,2024-05-10 21:49:53,293,;'

   
    };
  } else {
    return {
      code: 401,
      message: '参数错误'
    };
  }
});

// 商品
Mock.mock("/product", "get", {
  code: 200,
  message: '成功',
  product: [

    {
      id: 1,
      name: "香槟玫瑰",
      category: "玫瑰花",
      price: "78元",
      quantity: 1,
      // image: "/images/玫瑰1.jpg",
      image: meigui,
      description: "香槟玫瑰，蔷薇科，蔷薇属，保加利亚的国花。又称月季(香槟金、香槟酒） 古代丝绸。",
      benefits: "",
      usage: "",
      origin: ""
    },
    {
      id: 2,
      name: "洋桔梗",
      category: "桔梗花",
      price: "68元",
      quantity: 2,
      image: jigeng,
      description: "洋桔梗中含有多种天然药用成分能消灭人体内的敏感菌和致病菌，并能防止人体内炎症滋生。",
      benefits: "",
      usage: "",
      origin: ""
    },
    {
      id: 3,
      name: "向日葵",
      category: "向日葵",
      price: "59元",
      quantity: 1,
      image: xiangrikui2,
      description: "向日葵是桔梗目、菊科、向日葵属的植物。因花序随太阳转动而得名。是一年生高大草本植物。",
      benefits: "",
      usage: "",
      origin: ""
    },
    {
      id: 4,
      name: "百合",
      category: "百合花",
      price: "19.9元",
      quantity: 1,
      image: baihe,
      description: "百合是百合科百合属植物。地下根茎为鳞茎球状，广展，无明显结节，白色；茎有紫色条纹，无毛；叶散生，上部叶常比中部叶小，倒披针形，叶缘平整，无毛，具有较短的叶柄；花为喇叭形，有香味，多为白色，背面带紫褐色，无斑点，顶端弯而不卷；蒴果矩圆形，有棱，内具多数种子。",
      benefits: "",
      usage: "",
      origin: ""
    },
    {
      id: 5,
      name: "香槟向日葵混搭",
      category: "向日葵",
      price: "62元",
      quantity: 1,
      image: xiangrikui3,
      description: "向日葵是桔梗目、菊科、向日葵属的植物。因花序随太阳转动而得名。是一年生高大草本植物。",
      benefits: "",
      usage: "",
      origin: ""
    },
    {
      id: 6,
      name: "满天星",
      category: "满天星",
      price: "69元",
      quantity: 1,
      image: mantianxing,
      description: "星满天又名满天星、碎叶冬青、白马骨、悉茗，原产中国。性喜阳光，也较耐阴，耐旱力强，生长在草地、固定沙丘、石质山坡及农田。",
      benefits: "",
      usage: "",
      origin: ""
    }

]
});

  // 订单
  Mock.mock("/order", "get", {
    code: 200,
    message: '成功',
    list: [
  
      {
        orderId: '10965992636738',
        name: "香槟玫瑰",
        category: "玫瑰花",
        price: "78元",
        quantity: 1,
        // image: "/images/玫瑰1.jpg",
        image: meigui,
        description: "香槟玫瑰，蔷薇科，蔷薇属，保加利亚的国花。又称月季(香槟金、香槟酒） 古代丝绸。",
        userName: "张三",
        phone: "18012345678",
        address: "河南省郑州市中原区",
        status:'已发货'
      },
      {
        orderId: '10965992636790',
        name: "洋桔梗",
        category: "桔梗花",
        price: "68元",
        quantity: 2,
        image: jigeng,
        description: "洋桔梗中含有多种天然药用成分能消灭人体内的敏感菌和致病菌，并能防止人体内炎症滋生。",
        userName: "张三",
        phone: "18012345678",
        address: "河南省郑州市中原区",
        status:'已发货'
      },
 
]
  });